package controllor

import (
	"fitness/internal/service"
	"fitness/pkg/middleware"
)

type ControllerContainer struct {
	UserController *UserController
	AuthController *AuthController
	MenuController *MenuController
	DeptController *DeptController
	DictController *DictController
	RoleController *RoleController
	LogController  *LogController
}

// CreateControllerInstance 创建单例
func CreateControllerInstance(serviceContainer *service.ServiceContainer, rbac *middleware.MiddlewareContainer) *ControllerContainer {
	sysUserController := NewUserController(serviceContainer.UserService, rbac.Rbac)
	authController := NewAuthController(serviceContainer.LoginService)
	menuController := NewMenuController(serviceContainer.MenuService, rbac.Rbac)
	deptController := NewDeptController(serviceContainer.DeptService, rbac.Rbac)
	dictController := NewDictController(serviceContainer.DictService, rbac.Rbac)
	roleController := NewRoleController(serviceContainer.RoleService, rbac.Rbac)
	logController := NewLogController(serviceContainer.LogService)
	return &ControllerContainer{
		UserController: sysUserController,
		AuthController: authController,
		MenuController: menuController,
		DeptController: deptController,
		DictController: dictController,
		RoleController: roleController,
		LogController:  logController,
	}
}
